package com.lingxu.traffic.controller;

import com.lingxu.base.common.api.vo.Result;
import com.lingxu.traffic.dto.ProjectOverviewDTO;
import com.lingxu.traffic.service.ProjectService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

@Slf4j
@RestController
@RequestMapping(value = "/overview")
public class ProjectGeneralOverviewController {

    @Autowired
    private ProjectService projectService;

    @GetMapping("/overviewData")
    public HashMap<String, Object>  projectOverview(String proType) {
//        String protype = projectOverviewDTO.getProtype();
        HashMap<String, Object> stringObjectHashMap = new HashMap<>();
        if (proType.equals("JJ")) {
            ProjectOverviewDTO projectOverview =  projectService.getGeneralOverview(proType);
            stringObjectHashMap.put("项目总数", projectOverview.getProNum());
            stringObjectHashMap.put("新建高速", projectOverview.getXjgs());
            stringObjectHashMap.put("新建高速公里数", projectOverview.getXjgsLength());
            stringObjectHashMap.put("改扩建高速", projectOverview.getGkjgs());
            stringObjectHashMap.put("改扩建高速公里数", projectOverview.getGkjgsLength());
            stringObjectHashMap.put("过江隧道", projectOverview.getGjsd());
            stringObjectHashMap.put("过江隧道公里数", projectOverview.getGjsdLength());
            stringObjectHashMap.put("桥梁", projectOverview.getQl());
            stringObjectHashMap.put("桥梁公里数",projectOverview.getQlLength());
            stringObjectHashMap.put("隧道", projectOverview.getSd());
            stringObjectHashMap.put("隧道公里数",projectOverview.getSdLength());
            stringObjectHashMap.put("项目总投资", projectOverview.getZtz());
        }
        else if (proType.equals("GD")) {
            ProjectOverviewDTO projectOverview =  projectService.getGeneralOverviewGD(proType);
            stringObjectHashMap.put("国道", projectOverview.getGdxm());
            stringObjectHashMap.put("国道公里数", projectOverview.getGdLength());
            stringObjectHashMap.put("省道", projectOverview.getSdxm());
            stringObjectHashMap.put("省道公里数", projectOverview.getSdLength());
            stringObjectHashMap.put("桥梁", projectOverview.getQlxm());
            stringObjectHashMap.put("桥梁公里数", projectOverview.getQlLength());
            stringObjectHashMap.put("项目总数", projectOverview.getProNum());
            stringObjectHashMap.put("项目总投资", projectOverview.getZtz());
        }
        else if (proType.equals("GH")){
            ProjectOverviewDTO projectOverview =  projectService.getGeneralOverviewGH(proType);
            stringObjectHashMap.put("航道类项目", projectOverview.getHdlxm());
            stringObjectHashMap.put("航道类项目公里数", projectOverview.getHdlLength());

            stringObjectHashMap.put("港口类项目", projectOverview.getGklxm());
            stringObjectHashMap.put("港口类项目公里数", projectOverview.getGklLength());
            stringObjectHashMap.put("项目总数", projectOverview.getProNum());
            stringObjectHashMap.put("项目总投资", projectOverview.getZtz());
        }
        return stringObjectHashMap;
    }
}
